import { createMemoryHistory, createRouter } from 'vue-router'

import HomeView from '../views/HomeView.vue'
import LoginView from '../views/LoginView.vue'
import PublishersView from '../views/Publishers.vue'
import BooksView from '../views/BooksView.vue'
import OrdersView from '../views/OrdersView.vue'
import AuthorsView from '../views/AuthorsView.vue'
import BooksByXView from '../views/BooksByXView.vue'
import BooksByAuthorView from '../views/BooksByAuthorView.vue'
const routes = [
  { path: '/', name:'home',component: HomeView,
    children:[
        {path:'publishers',name:'publishers',component:PublishersView},
        {path:'books',name:'books',component:BooksView},
        {path:'orders',name:'orders',component:OrdersView},
        {path:'authors',name:'authors',component:AuthorsView},
        {path:'booksByAuthor/:id',name:'booksByAuthor',component:BooksByAuthorView,props:true},
        {path:'booksByX/:id',name:'booksByX',component:BooksByXView,props:true}
    ]
   },
  { path: '/login',name:'login', component: LoginView }
]

const router = createRouter({
  history: createMemoryHistory(),
  routes,
})

export default router